home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 4407 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  3.4 KB

  1. Path: iafrica.com!not-for-mail
  2. From: vincer@iaccess.za (Vince Risi)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: C vs Pascal
  5. Date: 30 Jan 1996 09:09:29 +0200
  6. Organization: Internet Africa public service
  7. Message-ID: <DOTDxg2yqHDV083yn@iaccess.za>
  8. References: <8B87053.0054014A15.uuout@swcbbs.com>
  9.  <8B8F52F.0054014CDF.uuout@swcbbs.com> <4e0huu$rhn@classic.iinet.com.au>
  10.  <310ab831.512924160@news.cyberport.com>
  11. NNTP-Posting-Host: minnie.iafrica.com
  12.  
  13. In article <310ab831.512924160@news.cyberport.com>,
  14. tangent@cyberport.com (Warren Young) wrote:
  15.  
  16. > Let's turn the tables, though, and see how many things TP swiped from
  17. > C/C++:
  18. >
  19. > o  Classes (or whatever TP with Objects calls them)
  20.  
  21. I suspect Object Pascal which precedes TP 5.5 may have "borrowed"
  22. them from Simula (which is where C++ got them too)
  23.  
  24. > o  Free-form declarations -- standard Pascal requires that your
  25. > declarations be segregated by type, with only one type group at each
  26. > level of scope.
  27.  
  28. TP or (KomPas) was a renegade here at version 1.0. I wonder if Anders
  29. was aware of C at that time. Certainly C was not ANSI at that
  30. time and C++ was just a twinkle in the Bjarne eye.
  31.  
  32. > o  Bitwise operators
  33.  
  34. Bitwise operators precede C.
  35.  
  36. > o  Separate compilation (UNITs and modules)
  37.  
  38. C and C++ do not support separate compilation, only independant
  39. compilation. Mores the pity. UCSD Pascal introduced units based
  40. on a 1971 paper on separate versus independant compilation.
  41.  
  42. > o  Conditional compilation
  43.  
  44. > What has C/C++ still got that TP doesn't?
  45.  
  46. > o  Multiple inheritance
  47.  
  48. Debatable plus.
  49.  
  50. > o  Variable-length argument lists
  51.  
  52. Delphi's object pascal supports more than just variable length
  53. argument lists, it supports many variable argument lists. viz.
  54.  
  55. function Cross(R1, R2 : array of double) : double;
  56. var
  57.   i1, i2 : integer;
  58. begin
  59.   result := 0;
  60.   for i1 := 0 to high(R1) do
  61.     for i2 := 0 to high(R2) do
  62.       result := result + R1[i1] * R2[i2];
  63. end;
  64.  
  65. ...
  66.   Cross1 := Cross([1.0, 2.0, 3.0], [7.2, 7.1, 7.3, 7.7, 9.1]);
  67.   Cross2 := Cross([5.0, 4.0, 3.0, 2.0, 1.0], [7.1, 7.3, 7.7]);
  68. ...
  69.  
  70. > o  Forward references and prototypes.  Functions don't have to be in a
  71. > specific order in C/C++.
  72.  
  73. The earliest Pascals supported forward references. C++ does not
  74. appreciate undeclared functions at all. It is also bad coding
  75. style to assume undefined variables and functions are int.
  76.  
  77. > o  A more powerful base language -- Try writing writeln() in Pascal
  78. > sometime.  You can't do it because the language doesn't support vararg
  79. > functions, so the language had to have that function defined into it.
  80. > Same goes for ord() and more.  None of the functions in the C/C++
  81. > standard are built into the language, because they don't have to be.
  82.  
  83. Check out format in Delphi. A better printf than printf. Typesafe.
  84. Nudge nudge, wink wink, say no more.
  85.  
  86. > o  Pointer arithmetic -- try writing strcpy() in Pascal.  Or anything
  87. > else that manipulates blocks of memory.  Related to this is that,
  88. > because the size of an array is a part of its type, you can't have
  89. > general-purpose memory-block manipulation routines.
  90.  
  91. Piece of old tacky. Check out the strings unit for TP6.0 only
  92. 4 years old by now.
  93.  
  94. > And to be fair, there is at least one thing Pascal has that C/C++
  95. > doesn't: nested procedures.  Whoop!
  96. >
  97. > I am a professional C++ programmer who started with ISO Pascal, and
  98. > have had many similar discussions with your fellow TPers.  I remain
  99. > unconvinced.
  100.  
  101. Get a life, have fun, check out Delphi, it is way COOL (and mainstream).
  102.  
  103. Vince
  104. =====
  105.